<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=, initial-scale=1.0" />
        <title>Document</title>
    </head>
    <body>
        <h2>测试</h2>

        <script>
            // *****
            async function fn() {
                try {
                    // await  等待
                    let result = await new Promise((resolve, reject) => {
                        setTimeout(() => {
                            console.log(11);
                            // resolve('ok');
                            // reject('error');
                        }, 2000);
                    });
                    // then 成功的回调
                    console.log(22);
                } catch (e) {
                    // then 失败的回调
                    console.log(33);
                }
            }

            fn();

            // p.then(v => {

            // }, r => {

            // })
        </script>
    </body>
</html>
s
